<?php
/**
 * STRING enhancement
 *
 * @version 0.2a
 */

// No direct access
defined( "__DEENZO__" ) or die( "deenzo$" );

function att( $att, $args ) {

    /* Parse ARGS */
	eval( ARGL );
	
	/* XML style : attrib = "value" */
	if ( $x ) {
	    foreach ( $att as $k => $v )
	        $argv .= " $k = \"$v\" ";

	/* Command-line style */
	} elseif ( $c ) {
		foreach ( $att as $k => $v )
			$argv .= "-$k '$v' ";
	} 
	
	return trim( $argv );
	    
}

function url_decode( $url, $args = "" ) {
	
	/* Parse ARGS */
    eval( ARGL );
    
	/** -Q work only with GET param style */
	if ( $q ) {
		$args = explode( "&", $url );
		
		/* Exploding params by ampersand */
		for ( $i = 0; $i < count( $args ); $i++ ) 
			$args[ $i ] = explode( "=", $args[ $i ] );
		
		for ( $i = 0; $i < count( $args ); $i++ ) 
			$argv[ $args[$i][0] ] = urldecode( $args[$i][1] );
		
		return $argv;
		
	}
		
	/* Return information from URL */
	$url = (object) parse_url( $url );
        
    if ( $p )     return $url->path;
    elseif ( $h ) return $url->host;
    elseif ( $s ) return $url->scheme;
    else          return $url->query; 
}